package asimes.reflect;

public class ReflectDemo {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        Servant servant = new Servant();
        servant.service("Hello");

        Class<Servant> servantClass = Servant.class;
        Class servantClass2 = servant.getClass();
        Class servantClass3 = Class.forName("asimes.reflect.Servant");

        Servant servant1 = (Servant) servantClass.newInstance();
        servant1.service("OK");

    }
}
